import Vue from 'vue/dist/vue.esm.js'
import Router from 'vue-router'

Vue.use(Router)

const router = new Router({
  routes: [
    {
      path: '',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('../components/home'),
      meta: {
        routerPath: '/home'
      }
    },
    {
      path: '/movieDetail',
      name: 'movieDetail',
      component: () => import('../components/movieDetail'),
      meta: {
      }
    },
    {
      path: '/admin',
      name: 'admin',
      redirect: 'admin/login',
      component: () => import('../components/admin'),
      children: [
        {
          path: 'login',
          name: 'login',
          component: () => import('../components/admin/login'),
        },
        {
          path: 'movieList',
          name: 'movieList',
          component: () => import('../components/admin/movieList'),
        }
      ]
    },
    {
      path: '/404',
      name: 'notFound',
      component: () => import('../components/404')
    },
    {
      path: '*',
      redirect: '/404'
    }
  ]
})

export default router
